package beans;

import entities.VentasDetalle;
import controllers.VentasDetalleFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "ventasDetalleController")
@ViewScoped
public class VentasDetalleController extends AbstractController<VentasDetalle> implements Serializable {

    @EJB
    private VentasDetalleFacade ejbFacade;

    public VentasDetalleController() {
        super(VentasDetalle.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getVentasDetallePK().setNroFactura(this.getSelected().getVentasCabecera().getNroFactura());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setVentasDetallePK(new entities.VentasDetallePK());
    }
}
